package com.hqd.ch03.v11.config;

import com.hqd.ch03.v11.factory.ConfigurableBeanFactory;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

@Data
public class BeanDefinition {
    private String id;
    private String beanClass;
    private String scope;
    private Boolean lazyInit;
    private String initMethodName;
    private String destroyMethodName;
    private String description;
    private MutablePropertyValues properties;
    private ConstructorArgumentValues constructorArgumentValues;
    private String SCOPE_SINGLETON = ConfigurableBeanFactory.SCOPE_SINGLETON;
    private String SCOPE_PROTOTYPE = ConfigurableBeanFactory.SCOPE_PROTOTYPE;

    public boolean isSingleton() {
        return StringUtils.equalsIgnoreCase(SCOPE_SINGLETON, scope);
    }

    public boolean isPrototype() {
        return StringUtils.equalsIgnoreCase(SCOPE_PROTOTYPE, scope);
    }
}
